import { defineStore } from 'pinia'
import {
	requestArticleCategoryDel, 
	requestArticleCategoryGet, 
	requestArticleCategoryInsert,
	requestArticleCategoryList,
	requestArticleCategoryUpdate,
	CategoryInfo,
	CategoryListInfo
}from '../service/articleCategory'

// 文章分类管理
export default defineStore('useArticleCategoryStore',()=>{
	
	// 删除分类
	const articleCategoryDel = async (delId: {id: number}) => {
		const res = await requestArticleCategoryDel(delId)
		console.log(res, "| res");
	}
	
	// 分类详情
	const articleCategoryGet = async (getId: {id: number}) => {
		const res = await requestArticleCategoryGet(getId)
		console.log(res, "| res");
	}
	
	// 新增分类
	const articleCategoryInsert = async (categoryInfo: CategoryInfo) => {
		const res = await requestArticleCategoryInsert(categoryInfo)
		console.log(res, "| res");
	}
	
	// 获取分类列表
	const articleCategoryList = async (categoryListInfo: CategoryListInfo) => {
		const res = await requestArticleCategoryList(categoryListInfo)
		console.log(res, "| res");
	}
	
	// 更新分类
	const articleCategoryUpdate = async (categoryInfo: CategoryInfo) => {
		const res = await requestArticleCategoryUpdate(categoryInfo)
		console.log(res, "| res");
	}
	
	
	return {
		articleCategoryDel,
		articleCategoryGet,
		articleCategoryInsert,
		articleCategoryList,
		articleCategoryUpdate
	}
})